home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3276 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.7 KB  |  60 lines

  1. Newsgroups: comp.lang.c
  2. Path: gail.ripco.com!mambuhl
  3. From: mambuhl@ripco.com (Martin Ambuhl)
  4. Subject: Re: Help!                
  5. X-Nntp-Posting-Host: foley.ripco.com
  6. Message-ID: <DLuCuA.Arp@rci.ripco.com>
  7. Sender: usenet@rci.ripco.com (Net News Admin)
  8. Organization: Ripco Internet BBS Chicago
  9. Date: Sat, 27 Jan 1996 13:15:45 GMT
  10. X-Ident-Sender: mambuhl
  11.  
  12. s3610165@maliwan.psu.ac.th (Sanon CHAOCHAIYAPORN)
  13. in <4ea5p4$j0s@ratree.psu.ac.th> asks:
  14.  
  15.  
  16. >        There is a file, hi.bat, in my 'h:\data' directory and I try to
  17. >run it by C program but it fail. Please, advice to me?
  18.  
  19. We will ignore the non-standard headers conio.h and dir.h and the
  20. non-standard functions clrscr(), chdir() and getch().  You actually have
  21. a C problem:
  22. >chdir("h:\data");
  23.  
  24. replace with:
  25.  chdir("h:\\data");
  26. or
  27.  chdir("h:/data");
  28.  
  29. BTW:  The header stdio.h is unused, so not needed.  It is a GoodIdea to
  30. implicitly declare the return type of main -- int main(void) -- and to
  31. explicitly return its value -- e.g. return 0;.
  32.  
  33. >Source:
  34.  
  35. >#include<stdio.h>
  36. >#include<stdlib.h>
  37. >#include<conio.h>
  38. >#include<dir.h>
  39.  
  40. >main()
  41. >{
  42. >clrscr();
  43. >chdir("h:\data");
  44. >system("hi.bat");
  45. >getch();
  46. >}
  47.  
  48.  
  49. >--
  50. >        ----------------------------------------------------------------
  51. >        |                              |                               |
  52. >        |  Sanon Chaochaiyaporn        |  Prince of Songkla University |
  53. >        |  s3610165@maliwan.psu.ac.th  |  Hadyai, Thailand             |
  54. >        |                              |                               |
  55. >        ----------------------------------------------------------------
  56.                               
  57. --
  58. * Martin Ambuhl       net: mambuhl@ripco.com
  59. * Chicago, IL (USA)    
  60.